package com.cans.lightning.base.dao.api;

import com.cans.lightning.base.entity.BaseEntity;
import org.beetl.sql.mapper.BaseMapper;

import java.util.Date;

/**
 * @author cans
 * @date 2022/10/30
 **/
public interface IBaseDao<E extends BaseEntity> extends BaseMapper<E> {
    default void insert(E e) {
        Date date = new Date();
        e.setCreateTime(date);
        e.setLastChangeTime(date);
        this.getSQLManager().insert(e);
    }

    default int updateById(E e) {
        Date date = new Date();
        e.setCreateTime(date);
        e.setLastChangeTime(date);
        return this.getSQLManager().updateById(e);
    }

}
